<?php
class user_model extends CI_Model
{
    protected $_table = "mock_user";
    public function __construct(){
        parent::__construct();
    }
    public function checkUser($field,$data,$id=''){
        if($id != ''){
            $this->db->where('user_id !=',$id);
        }
        $this->db->where($field,$data);
        $numrows = $this->db->count_all_results($this->_table);
        if($numrows >0){
            return FALSE;
        }else{
            return TRUE;
        }
    }



    public function totalUsers(){
        return $this->db->count_all($this->_table);
    }
    public function listUsers($off,$start){
        $this->db->limit($off,$start);
        return $this->db->get($this->_table)->result_array();
    }
    public function update($id,$data){
        $this->db->where("user_id",$id);
        $this->db->update($this->_table,$data);
    }
    public function getdata($id){
        $this->db->where("user_id",$id);
        return $this->db->get($this->_table)->row_array();
    }

}
// Select * from _table order by